<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="perm" uri="/WEB-INF/tld/perm.tld"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script>var ctx="${ctx}";</script>
<div class="form-horizontal" role="form" >
    <div class="form-group" id="tableNameSelectId">
 	    <label class="col-md-3 col-sm-3 control-label">视图名:</label>
        <div class="col-md-9">
        	<select id="tableNameSelect" placeholder="选择视图名" class="form-control chosen-select " tabindex="4">
			</select>
        </div>
    </div>
    <div class="div-top-line">
		<div class="form-group">
	 	    <label class="col-md-3 col-sm-3 control-label">视图列名称:</label>
	        <div class="col-md-9">
	        	<input id="cloName" value="${tabVisible.cloName}"  onkeyup="value=value.replace(/[^a-zA-Z-_]/g,'')"  maxlength="20"  type="text" placeholder="视图列名称" class="form-control" name="remark"/>
	        </div>
	    </div>
	    <div class="form-group">
	 	    <label class="col-md-3 col-sm-3 control-label">视图列描述:</label>
	        <div class="col-md-9">
	        	<input id="cloDesc" value="${tabVisible.cloDesc}"  maxlength="100" type="text" placeholder="视图列描述" class="form-control" name="remark"/>
	        </div>
	    </div>
    </div>
</div>

<script>
	$(function(){
		
		jQuery.checkall(false);
		
		$("#tableNameSelect").chosen({ width: '100%' })
		
		var tableName=$("#tableContent").data("table-name");
		
		$.ajax({  
			url:'${ctx}/tbVisible/listTableNames',  		 					
			dataType:'json',  
			type:"POST",
			success:function(response){
				if(response.code==0){
					var html=[];
					var data=response.data||[];
					for(var i=0;i<data.length;i++){
						if(data[i].tableEnName == tableName){
							html.push('<option value="'+data[i].tableEnName+','+data[i].tableCnName+'" hassubinfo="true" selected>'+data[i].tableCnName+'('+data[i].tableEnName+')</option>');
						}else{
							html.push('<option value="'+data[i].tableEnName+','+data[i].tableCnName+'" hassubinfo="true">'+data[i].tableCnName+'('+data[i].tableEnName+')</option>');
						}
					}
					$("#tableNameSelect").append(html.join(""));
					$("#tableNameSelect").trigger("chosen:updated");
				}
			}  
	    });
	})
</script>